<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="./css/reset.css">
    <link rel="stylesheet" href="./css/index.css">
    <link rel="stylesheet" href="./css/login.css">
</head>

<body>
    <div class="navWrap">
        <div class="nav ls">
            <div class="navList">
                <a href="">登录/注册</a>
                <a href="">我的订单</a>
                <a href="">会员</a>
                <a href="">甄选家</a>
                <a href="">企业采购</a>
                <a href="">客户服务</a>
                <a href="" class="border-none">APP</a>
            </div>
        </div>
    </div>
    <div class="navt ls">
        <div class="navTop">
            <a href="" class="mylogo">网易严选</a>
            <div class="searchbox">
                <input type="text" id="txt1">
                <div class="searchbtn">搜索</div>
            </div>
            <a href="" class="cart">购物车</a>
        </div>
        <div class="navBottom">
            <ul class="navBottom-list">
                <li class="active">
                    <a href="./index.html">首页</a>
                </li>
                <!-- <li>
                    <a href="">居家生活</a>
                    <div class="navchilds">
                        <div class="childtypes">
                            <h2>好物精选</h2>
                            <ul class="childitems">
                                <li>
                                    <a href="">
                                        <img src="https://yanxuan.nosdn.127.net/0dd4db7175684809f98db4a172568c22.jpg" alt="">
                                        <span>秋季换新</span>
                                    </a>
                                </li>
                            </ul>
                        </div>
                    </div>
                </li> -->
            </ul>
        </div>
    </div>


    <div class="bigbox">
        <div class="zcdl">
            <div class="zc-tab">
                <span>注册</span>
                <span>登录</span>
            </div>
            <div class="zc-detail">
                <form>
                    <p class="form-item">
                        <label>用户名:</label>
                        <input type="text" id="username">
                    </p>

                    <p class="form-item">
                        <label>密码</label>
                        <input type="text" id="password">
                    </p>

                    <div class="dl">
                        <input type="button" id="btn" value="注册"><span></span>
                    </div>
                </form>
            </div>
        </div>
    </div>


    <div class="footer-wrap">
        <div class="footer ls">
            <div class="footer-top">
                <span>网易自营电商</span>
                <span>30天无忧退换货</span>
                <span>满99元邮费</span>
                <span>品质保证</span>
            </div>

        </div>
        <div class="footer-bottom">
            <p>
                <a href="">关于我们</a>|
                <a href="">关于我们</a>|
                <a href="">关于我们</a>|
                <a href="">关于我们</a>|
                <a href="">关于我们</a>|
                <a href="">关于我们</a>|
                <a href="">关于我们</a>|
                <a href="">关于我们</a>|
                <a href="">关于我们</a>|
                <a href="">关于我们</a>
            </p>
            <p>
                <a href="">食品经营许可证：JY13301080111719</a>
                <a href="">出版物经营许可证：新出发滨字第0132号</a>
                <a href="">妙得ICP证号：ICP 证浙B2-20160106</a>
                <a href="">浙杭食药监械经营备20171029号</a>
                <a href="">营业执照</a>
                <a href="">网易公司版权所有 © 1997-</a>
                <a href="">2021</a>
            </p>
            <p>
                <a href="">无线电发射设备销售备案：42202011096855</a>
                <a href="">（浙杭）网械企备字[2019]第00119号</a>
                <a href="">（粤）网械平台备字（2019）第00004号</a>
                <a href="">（粤）-非经营性-2016-0023</a>
                <a href="">进口冷链食品管理承诺书</a>
            </p>
            <p>
                <a href="">食品经营许可证：JY14207050007694</a>
                <a href="">浙江省网络食品销售第三方平台提供者备案：浙网食A33010009</a>
                <a href="">单用途商业预付卡备案证：330100AAC0024</a>
            </p>
        </div>
    </div>

</body>

<script src="libs/jquery.js"></script>
<script src="./libs/jquery.js"></script>
<script src="./js/index.js"></script>
<script>

    $("#btn").click(function () {
        console.log({
            type: "register",
            un: $("#username").val(),
            pw: $("#password").val()
        })
        $.ajax({
            url: "http://127.0.0.1:3000/apiData/login",
            data: {
                type: "register",
                un: $("#username").val(),
                pw: $("#password").val()
            },
            success: res => {
                res = JSON.parse(res)
                // console.log(res)
                // console.log(res.code)
                if (res.code === 1) {
                    $("#btn").next().html("注册成功，3秒后跳转到<a href='login.html'>登录</a>")
                    setTimeout(() => {
                        location.href = "login.html";
                    }, 3000);
                } else if (res.code === 0) {
                    alert("你的用户名被注册了，不好意思换一个吧");
                }
            }
        })
    })
</script>

</html>